package br.ufrj.dcc.smarthotel.listeners;

import java.util.Hashtable;

import android.view.View;
import android.view.View.OnClickListener;
import br.ufrj.dcc.smarthotel.R;
import br.ufrj.dcc.smarthotel.activities.EventDetailActivity;
import br.ufrj.dcc.smarthotel.activities.InvitePeopleActivity;

public class EventDetailClickListener implements OnClickListener {
	private EventDetailActivity activity;
	
	public EventDetailClickListener (EventDetailActivity activity) {
		this.activity = activity;
	}
	
	public void onClick(View v) {
		if (v.getId() == R.id.btnConfirmAttendant) {
			if (this.activity.userIsAttendant()) {
				this.activity.UnconfirmUser();
			}
			else {
				this.activity.ConfirmUser();
			}
    	}
    	else {
    		if (v.getId() == R.id.btnInvitePeople) {
    			Hashtable<String, String> parameters = new Hashtable<String, String>();
    			
    			parameters.put("clickedEventId", String.valueOf(this.activity.getClickedEvent().getEventId()));
    			
    			this.activity.startActivity(InvitePeopleActivity.class, parameters, 1);
    		}
    	}
	}

}
